package dao.impl;

import dao.ScDao;
import pojo.Course;
import pojo.Sc;

import java.util.List;

public class ScDaoImpl extends BaseDao implements ScDao {
    @Override
    public int addSc(Sc sc) {
        String sql="insert into sc (scno,sno,cno,mark) values (?,?,?,?)";
        return update(sql,sc.getScno(),sc.getSno(),sc.getCno(),sc.getMark());
    }

    @Override
    public int deleteScbyScno(String scno) {
        String sql="delete from sc where scno=?";
        return update(sql,scno);
    }

    @Override
    public int upDateSc(Sc sc) {
        String sql="update sc set sno=?, cno=?, mark=? where scno=?";
        return update(sql,sc.getSno(),sc.getCno(),sc.getMark(),sc.getScno());
    }

    @Override
    public Sc queryScByScno(String scno) {
        String sql = "select scno, sno, cno, mark from sc where scno=?";
        return queryForOne(Sc.class,sql,scno);
    }

    @Override
    public List<Sc> querySc() {
        String sql="select scno, sno, cno, mark from sc";
        return queryForList(Sc.class,sql);
    }
}
